package com.zheng.damo1;

public class Test1 {
    public static void main(String[] args) {
        String str="sjfbADKK546HJjkkn";
        getStringNumber(str);
        charNumber(str);

    }

    private static void charNumber(String str) {
        int count=0;
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i)=='k'){
                count++;
            }
        }
        System.out.println(count);
    }

    private static void getStringNumber(String str) {
        int count1=0;
        int count2=0;
        int count3=0;
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i)>='a'&& str.charAt(i)<='z'){
                count1++;
            }else if (str.charAt(i)>='A'&& str.charAt(i)<='Z'){
                count2++;
            }else if (str.charAt(i)>='0'&& str.charAt(i)<='9'){
                count3++;
            }
        }
        System.out.println("小写字母："+count1+" 大写字母："+count2+" 数字个数："+count3);
    }
}
